﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Reactive.Disposables;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using ReactiveUI;

namespace ScienceAIApp.Views;

/// <summary>
/// Interaction logic for FirstScreenView.xaml
/// </summary>
public partial class FirstScreenView
{
    public FirstScreenView()
    {
        InitializeComponent();
        this.WhenActivated(_activated);
    }

    private void _activated(CompositeDisposable disposable)
    {
        this.OneWayBind(
                ViewModel,
                vm => vm.MainContentViewModel,
                v => v.MainViewHost.ViewModel)
            .DisposeWith(disposable);

        this.OneWayBind(
                ViewModel,
                vm => vm.LeftMenuViewModel,
                v => v.MenuViewHost.ViewModel)
            .DisposeWith(disposable);
    }

    private void ShutDown(object sender, RoutedEventArgs e)
    {
        var result = MessageBox.Show("Close Application ？", "ScienceAi PopUp", MessageBoxButton.OKCancel);

        if (result == MessageBoxResult.OK)
        {
            Application.Current.Shutdown();
        }
        else
        {
            // 用户点击了“取消”按钮或关闭了对话框
        }
        
    }
}
